package com.naizhuai.util;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.naizhuai.R;

/**
 * 事件view的创建类
 * Created by code_han on 2018/6/15.
 */

public class ErrorViewCreateUtils {

    //创建空内容view
    public static View createEmptyView(Context mContext) {
        return View.inflate(mContext, R.layout.multstate_empty, null);
    }

    //创建空搜索的View
    public static View createNoSearchView(Context mContext) {
        return View.inflate(mContext, R.layout.multstate_no_search, null);
    }

    //创建加载中的view
    public static View createLoadingView(Context mContext) {
        return View.inflate(mContext, R.layout.multstate_loading, null);
    }

    //创建加载失败的View
    public static View createErrorView(Context mContext) {
        return View.inflate(mContext, R.layout.multstate_error, null);
    }

    //创建没有消息的View
    public static View createNoMsgView(Context mContext) {
        return View.inflate(mContext, R.layout.multstate_nomsg, null);
    }

    //创建没有网络的View
    public static View createNoNetworkView(Context mContext, View.OnClickListener listener) {
        View view = View.inflate(mContext, R.layout.multstate_nonetwork, null);
        TextView setting = view.findViewById(R.id.setting_network);
        setting.setOnClickListener(listener);
        return view;
    }

    //创建没有权限的View
    public static View createNoPowerView(Context mContext) {
        return View.inflate(mContext, R.layout.multstate_nopower, null);
    }

    //创建没有设置模拟数据的View
    public static View createNoSimulateView(Context mContext, View.OnClickListener listener) {
        View view = View.inflate(mContext, R.layout.multstate_nosimulate, null);
        TextView setting = view.findViewById(R.id.goto_setting);
        setting.setOnClickListener(listener);
        return view;
    }
}
